package avicit.bdp.oss.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2021-01-12
 * @类说明：ObjectUserRelDto
 * @修改记录：
 * @注意事项：
 * @功能：对象-用户关系
 */
@ApiModel(value = "ObjectUserRelDto", description = "bdp_oss_object_user_r")
@Table(name = "bdp_oss_object_user_r")
public class ObjectUserRelDto extends BaseDTO {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 桶ID
     */
    @LogField
    @ApiModelProperty(value = "桶ID")
    @FieldRemark(column = "bucket_id", field = "bucket_id", name = "桶ID")
    @Column(name = "bucket_id")
    private String bucketId;

    /**
     * 对象ID
     */
    @LogField
    @ApiModelProperty(value = "对象ID")
    @FieldRemark(column = "object_id", field = "object_id", name = "对象ID")
    @Column(name = "object_id")
    private String objectId;

    /**
     * 用户ID
     */
    @LogField
    @ApiModelProperty(value = "用户ID")
    @FieldRemark(column = "user_id", field = "user_id", name = "用户ID")
    @Column(name = "user_id")
    private String userId;

    /**
     * 桶名称
     */
    @LogField
    @ApiModelProperty(value = "桶名称")
    @FieldRemark(column = "bucket_name", field = "bucket_name", name = "桶名称")
    @Column(name = "bucket_name")
    private String bucketName;

    /**
     * 对象前缀
     */
    @LogField
    @ApiModelProperty(value = "对象前缀")
    @FieldRemark(column = "prefix", field = "prefix", name = "对象前缀")
    @Column(name = "prefix")
    private String prefix;

    /**
     * 对象名称
     */
    @LogField
    @ApiModelProperty(value = "对象名称")
    @FieldRemark(column = "object_name", field = "object_name", name = "对象名称")
    @Column(name = "object_name")
    private String objectName;

    /**
     * 无参构造函数
     */
    public ObjectUserRelDto() {
    }

    /**
     * 有参构造函数
     */
    public ObjectUserRelDto(String id, String bucketId, String objectId, String userId,
                            String bucketName, String prefix, String objectName) {
        this.id = id;
        this.bucketId = bucketId;
        this.objectId = objectId;
        this.userId = userId;
        this.bucketName = bucketName;
        this.prefix = prefix;
        this.objectName = objectName;
    }

    public String getId() {
        return id;
    }

    public String getObjectId() {
        return objectId;
    }

    public String getBucketId() {
        return bucketId;
    }

    public String getUserId() {
        return userId;
    }

    public String getBucketName() {
        return bucketName;
    }

    public String getPrefix() {
        return prefix;
    }

    public String getObjectName() {
        return objectName;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setObjectId(String objectId) {
        this.objectId = objectId;
    }

    public void setBucketId(String bucketId) {
        this.bucketId = bucketId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public void setObjectName(String objectName) {
        this.objectName = objectName;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "对象用户关系模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "对象用户关系";
        } else {
            return super.logTitle;
        }
    }

    public static ObjectUserRelDto.Builder builder() {
        return new ObjectUserRelDto.Builder();
    }

    /**
     * 构造器
     */
    public static final class Builder {
        String id;
        String bucketId;
        String objectId;
        String userId;
        String bucketName;
        String prefix;
        String objectName;

        public Builder() {
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder bucketId(String bucketId) {
            this.bucketId = bucketId;
            return this;
        }

        public Builder objectId(String objectId) {
            this.objectId = objectId;
            return this;
        }

        public Builder userId(String userId) {
            this.userId = userId;
            return this;
        }

        public Builder bucketName(String bucketName) {
            this.bucketName = bucketName;
            return this;
        }

        public Builder prefix(String prefix) {
            this.prefix = prefix;
            return this;
        }

        public Builder objectName(String objectName) {
            this.objectName = objectName;
            return this;
        }

        public ObjectUserRelDto build() {
            return new ObjectUserRelDto(id, bucketId, objectId, userId, bucketName, prefix, objectName);
        }
    }
}
